# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cafebabe
pkgver=0.1.2
pkgrel=1
pkgdesc='Java bytecode editor & decompiler.'
arch=('any')
groups=('blackarch' 'blackarch-decompiler' 'blackarch-reversing')
url='https://github.com/GraxCode/Cafebabe/releases/'
license=('GPL3')
depends=('java-environment')
source=("https://github.com/GraxCode/Cafebabe/releases/download/$pkgver/Cafebabe-Editor-$pkgver.jar")
noextract=("Cafebabe-Editor-$pkgver.jar")
md5sums=('b2c5e91b203aea0d6faa9e04d366d58a')

package() {
  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 755 "Cafebabe-Editor-$pkgver.jar" "$pkgdir/usr/share/$pkgname/Cafebabe-Editor-$pkgver.jar"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec java -jar /usr/share/$pkgname/Cafebabe-Editor-$pkgver.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

